package org.xb.Demo02;

import java.util.ArrayList;
import java.util.List;

/**
 * @Author
 * @Description
 * @Date created in 17:25 2023/12/11
 */
public class ConcreteSubject implements Subject{
    private List<Observer> arr = new ArrayList<>();

    @Override
    public void addNotify(Observer observer) {
        arr.add(observer);
    }

    @Override
    public void delNotify(Observer observer) {
        arr.remove(observer);
    }

    @Override
    public void Notify(String message) {
        arr.forEach(x->{
            x.Update(message);
        });
    }
}
